//
//  FourthChapterViewController.m
//  CoreAnimation
//
//  Created by 张国文 on 16/10/10.
//  Copyright © 2016年 hangzhouyijiyin. All rights reserved.
//

#import "FourthChapterViewController.h"
#import "LayerAffineTransformViewController.h"
#import "LayerTransform3DViewController.h"
#import "MieDianViewController.h"
#import "SubLayerTransformViewController.h"
#import "DoubleSidedViewController.h"
#import "FlatteningOfLayerViewController.h"
#import "CubeViewController.h"

@interface FourthChapterViewController ()

@end

@implementation FourthChapterViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];

    UIButton *firstButton = [UIButton buttonWithType:UIButtonTypeCustom];
    firstButton.frame = CGRectMake(0, 20, 300, 50);
    [firstButton setTitle:@"Layer2D仿射变换" forState:UIControlStateNormal];
    [firstButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    firstButton.tag = 100;
    [firstButton addTarget:self action:@selector(clickJump:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:firstButton];
    
    UIButton *sectionButton = [UIButton buttonWithType:UIButtonTypeCustom];
    sectionButton.frame = CGRectMake(0, 70, 300, 50);
    [sectionButton setTitle:@"Layer的transform3D" forState:UIControlStateNormal];
    [sectionButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    sectionButton.tag = 101;
    [sectionButton addTarget:self action:@selector(clickJump:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:sectionButton];
    
    
    UIButton *thirdButton = [UIButton buttonWithType:UIButtonTypeCustom];
    thirdButton.frame = CGRectMake(0, 120, 300, 50);
    [thirdButton setTitle:@"Layer灭点-postion" forState:UIControlStateNormal];
    [thirdButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    thirdButton.tag = 102;
    [thirdButton addTarget:self action:@selector(clickJump:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:thirdButton];
    
    UIButton *fourthButton = [UIButton buttonWithType:UIButtonTypeCustom];
    fourthButton.frame = CGRectMake(0, 170, 300, 50);
    [fourthButton setTitle:@"subLayerTransform" forState:UIControlStateNormal];
    [fourthButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    fourthButton.tag = 103;
    [fourthButton addTarget:self action:@selector(clickJump:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:fourthButton];
    
    UIButton *fivethButton = [UIButton buttonWithType:UIButtonTypeCustom];
    fivethButton.frame = CGRectMake(0, 220, 300, 50);
    [fivethButton setTitle:@"doubleSided-背面" forState:UIControlStateNormal];
    [fivethButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    fivethButton.tag = 104;
    [fivethButton addTarget:self action:@selector(clickJump:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:fivethButton];
    
    UIButton *sixthButton = [UIButton buttonWithType:UIButtonTypeCustom];
    sixthButton.frame = CGRectMake(0, 270, 300, 50);
    [sixthButton setTitle:@"父视图、子视图 双向旋转" forState:UIControlStateNormal];
    [sixthButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    sixthButton.tag = 105;
    [sixthButton addTarget:self action:@selector(clickJump:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:sixthButton];
    
    UIButton *sevenButton = [UIButton buttonWithType:UIButtonTypeCustom];
    sevenButton.frame = CGRectMake(0, 320, 300, 50);
    [sevenButton setTitle:@"立方体" forState:UIControlStateNormal];
    [sevenButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    sevenButton.tag = 106;
    [sevenButton addTarget:self action:@selector(clickJump:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:sevenButton];


}

- (void)clickJump:(UIButton *)button
{
    switch (button.tag) {
        case 100:
        {
            LayerAffineTransformViewController *layerAffineTransformVC = [[LayerAffineTransformViewController alloc] init];
            [self.navigationController pushViewController:layerAffineTransformVC animated:YES];
            break;
        }
        case 101:
        {
            LayerTransform3DViewController *layerTransform3DVC = [[LayerTransform3DViewController alloc] init];
            [self.navigationController pushViewController:layerTransform3DVC animated:YES];
            break;
        }
            case 102:
        {
            MieDianViewController *mieDianVC = [[MieDianViewController alloc] init];
            [self.navigationController pushViewController:mieDianVC animated:YES];
            break;
        }
            case 103:
        {
            SubLayerTransformViewController *subLayerTransformVC = [[SubLayerTransformViewController alloc] init];
            [self.navigationController pushViewController:subLayerTransformVC animated:YES];
            break;
        }
            case 104:
        {
            DoubleSidedViewController *doubleSidedVC = [[DoubleSidedViewController alloc] init];
            [self.navigationController pushViewController:doubleSidedVC animated:YES];
            break;
        }
            case 105:
        {
            FlatteningOfLayerViewController *flatteningOfLayerVC = [[FlatteningOfLayerViewController alloc] init];
            [self.navigationController pushViewController:flatteningOfLayerVC animated:YES];
            break;
        }
            case 106:
        {
            CubeViewController *cubeVC = [[CubeViewController alloc] init];
            [self.navigationController pushViewController:cubeVC animated:YES];
        }
        default:
            break;
    }
}


@end
